package com.rbs.service.impl;

import com.rbs.entity.User;
import com.rbs.mapper.UserMapper;
import com.rbs.service.UserService;
import com.rbs.util.MybatisUtils;
import org.apache.ibatis.session.SqlSession;

public class UserServiceImpl implements UserService {
    @Override
    public User selectUserByUsernameAndPassword(String username, String password) {
        SqlSession session = null;
        User user = null;
        try {
            session = MybatisUtils.getSession();
            UserMapper mapper = session.getMapper(UserMapper.class);
            user = mapper.selectUserByUsernameAndPassword(username, password);
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            MybatisUtils.colesSession(session);
        }
        return user;
    }
}
